var order = ['red', 'yellow', 'blue', 'green', 'red']

Page({
    data: {
      toView: 'red',
      scrollTop: 100,
        imgUrls: [
            'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
            'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
            'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
        ],
        indicatorDots: false,
        autoplay: true,
        interval: 5000,
        duration: 1000,
        change_w_swiper:true,
        src:"../../dist/img/img/sprite.png",
        btn_text:"下一步",
        get_sex_btn_sel:false,//false 是女
        man_url: "http://woxiaoshitang.com/activity/Public/img/man_L.png",
        girl_url:"http://woxiaoshitang.com/activity/Public/img/female_sel_L.png",
        active_dot:0,
        now_scroll:0,
        finish_scroll:false,
        age_num_for: 
        [
          {
            num:18,
            flag:true,
          },
          {
            num: 19,
            flag: false,
          },
          {
            num: 20,
            flag: false,
          },
          {
            num: 21,
            flag: false,
          },
          {
            num: 22,
            flag: false,
          },
          {
            num: 23,
            flag: false,
          },
          {
            num: 24,
            flag: false,
          },
          {
            num: 25,
            flag: false,
          },
          {
            num: 26,
            flag: false,
          },
          {
            num: 27,
            flag: false,
          },
          {
            num: 28,
            flag: false,
          },
          {
            num: 29,
            flag: false,
          },
          {
            num: 30,
            flag: false,
          },
          {
            num: 31,
            flag: false,
          },
          {
            num: 32,
            flag: false,
          },
          {
            num: 33,
            flag: false,
          },
          {
            num: 34,
            flag: false,
          },
          {
            num: 35,
            flag: false,
          },
          {
            num: 36,
            flag: false,
          },
          {
            num: 37,
            flag: false,
          }
          , {
            num: 38,
            flag: false,
          },
          {
            num: 39,
            flag: false,
          },{
            num:40,
            flag:false
          }
          ],
        age_num:18,
      

    },
    man_tap:function(){
      console.log(this.data.get_sex_btn_sel);
      if(this.data.get_sex_btn_sel == false){
        console.log("yes")
        this.setData({
          man_url:"http://woxiaoshitang.com/activity/Public/img/man_sel_L.png",
          girl_url:"http://woxiaoshitang.com/activity/Public/img/female_L.png",
          get_sex_btn_sel:true
        })
      }else{
        this.setData({
          man_url: "http://woxiaoshitang.com/activity/Public/img/man_L.png",
          girl_url:"http://woxiaoshitang.com/activity/Public/img/female_sel_L.png",
          get_sex_btn_sel:false
        })
      }
    },
    onReady:function () {
       console.log("ready");
       console.log("111");
       //让swiper 的 item 小一点 （本来是100% ）现在要96% 因为有个jb阴影~~ 6
        this.setData({
            'change_w_swiper': 'false'
        })
    },
    changeIndicatorDots: function(e) {
        console.log("changeIndicatorDots");
        this.setData({
            indicatorDots: !this.data.indicatorDots
        })
    },
    changeAutoplay: function(e) {
        console.log("changeAutoplay")
        this.setData({
            autoplay: !this.data.autoplay
        })
    },
    intervalChange: function(e) {
        console.log("intervalChange")
        this.setData({
            interval: e.detail.value
        })
    },
    durationChange: function(e) {
        console.log("durationChange")
        this.setData({
            duration: e.detail.value
        })
    },
    // get_age_scroll
    scroll_left:function(){
      console.log("scroll_left")
    },
    scroll_right:function(){
      // console.log("scroll_right");
    },
    touch_start : function(){
      // console.log("touch_start")
    },
    touch_end :function(){
        // console.log("toch)end");
    },
    get_scroll:function(e){
      // console.log(11)
      // console.log(e.detail.scrollLeft)
      // console.log(parseInt(e.detail.scrollLeft/150))
      // if (e.detail.scrollLeft/150)
      //console.log(e.detail.scrollLeft)
      let age_num_for = this.data.age_num_for
      var num = parseInt(e.detail.scrollLeft / 135)
      // console.log(num)con
      // console.log(age_num_for[num].flag)
      for(var i=0;i<age_num_for.length;i++){
        age_num_for[i].flag=false;
      }
      age_num_for[num].flag = true;
      // console.log(age_num_for)
      this.setData({
        age_num: parseInt(e.detail.scrollLeft / 135)+18,
        age_num_for :age_num_for
      })
    },
    next:function(){
      wx.navigateTo({
        url: '../get_height/get_height'
      })
    }
})
